# 2018.8.11
# 递归方式遍历文件夹
# 重点函数:os.path.listdir(), os.path.join()

import sys
import os
import os.path

def main(path):
    if not os.path.isdir(path):
        print('Error: "{0}" is not a directory or does not exist.'.format(path))
    for lists in os.listdir(path):
        sub_path = os.path.join(path, lists)
        print(sub_path)
        if os.path.isdir(sub_path):
            main(sub_path)

if __name__ == "__main__":
    main(sys.argv[1])